<?php

// 限时抢购活动

namespace app\console\model;

use think\Model;
use think\Request;

class LimitedType extends Model
{
    // 模型事件
    protected static function init()
    {
        // 写入前
        self::event('before_write', function ($data) {
            $data->end_time = strtotime(Request::instance()->param('end_time'));
            $data->start_time = strtotime(Request::instance()->param('start_time'));
            $data->update_time = date('Y-m-d H:i:s', time());
        });


    }
}